﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.InteropServices;

public class Sys_Ram
{
    public struct MemoryStatus
    {
        public uint Length;
        public uint MemoryLoad;
        public uint TotalPhysical;
        public uint AvailablePhysical;
        public uint TotalPageFile;
        public uint AvailablePageFile;
        public uint TotalVirtual;
        public uint AvailableVirtual;
    }

    [DllImport("kernel32.dll")]
    public static extern void GlobalMemoryStatus(out MemoryStatus stat);

    public static string get_ram()
    {
        MemoryStatus stat = new MemoryStatus();
        GlobalMemoryStatus(out stat);
        long ram = (long)stat.TotalPhysical;

        return Size_Helper.GetFileSize(ram).ToString();
    }
}
